public class User {
	public String Name;
	private Conversation ConversationsQueue;

	public void sendMessageToUser(String inUser, String message,
			String GroupName) {
		GetConversation_ByGroupName(GroupName).addMessage(message, inUser);
	}

	public void CreateConversation(Conversation conversation) {

		if (ConversationsQueue == null) {
			ConversationsQueue = conversation;
			return;
		}

		Conversation newConversation = ConversationsQueue;
		while (newConversation.Next != null) {
			newConversation = newConversation.Next;
		}
		newConversation.Next = conversation;

	}

	public void removeConversationGroupFromUser(String inGroupName) {
		Conversation ConversationListPointer = ConversationsQueue;
		if (ConversationListPointer.ConversationGroupName.equals(inGroupName)) {
			ConversationsQueue = ConversationsQueue.Next;
		} else {
			boolean end = false;
			Conversation temp2 = ConversationListPointer.Next;
			while (ConversationListPointer != null
					&& ConversationListPointer.Next != null && !end) {

				if (ConversationListPointer.ConversationGroupName
						.equals(inGroupName)) {
					temp2.Next = ConversationListPointer.Next;
					end = true;
				} else {
					temp2 = ConversationListPointer.Next;
					ConversationListPointer = ConversationListPointer.Next;
				}
			}

		}
	}

	public Conversation GetConversation_ByGroupName(String inGroupName) {
		Conversation conversationPointer = ConversationsQueue;
		while (conversationPointer != null) {
			if (conversationPointer.ConversationGroupName.equals(inGroupName)) {
				return conversationPointer;
			}
			conversationPointer = conversationPointer.Next;
		}

		return null;
	}

	public String GetConversationByGroupName(String inGroupName) {
		Conversation conversationQuePointer = ConversationsQueue;
		while (conversationQuePointer != null) {
			if (conversationQuePointer.ConversationGroupName
					.equals(inGroupName)) {
				return conversationQuePointer.toString();
			}
			conversationQuePointer = conversationQuePointer.Next;
		}

		return null;
	}

	public String GetConversationList() {
		String retVal = "";
		Conversation conversationPointer = ConversationsQueue;
		while (conversationPointer != null) {
			retVal += conversationPointer.ConversationGroupName + "\n";
			conversationPointer = conversationPointer.Next;
		}
		return retVal;
	}
}
